package cn.cloud9.mybatisplusgenerator.config;

import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.unit.DataSize;

import javax.servlet.MultipartConfigElement;

@Configuration
public class MultipartConfiguration {
    /**
     * 版权声明：本文为CSDN博主「养生编程大队长」的原创文章，遵循CC 4.0 BY-SA版权协议，转载请附上原文出处链接及本声明。
     *     原文链接：https://blog.csdn.net/qq_27886773/article/details/102695145
     * @return
     */
    @Bean
    public MultipartConfigElement multipartConfigElement() {
        MultipartConfigFactory factory = new MultipartConfigFactory();
        factory.setMaxRequestSize(DataSize.ofGigabytes(1));
        factory.setMaxFileSize(DataSize.ofGigabytes(1));
        return factory.createMultipartConfig();
    }

}
